home *** CD-ROM | disk | FTP | other *** search
- property minLoc, maxLoc, itemNo, currentNo, spriteNo, slideLocList1, slideLocList2, vertical
-
- on birth me, slideRect, spriteNumber
- if getAt(slideRect, 1) = getAt(slideRect, 3) then
- set vertical to 1
- set minLoc to getAt(slideRect, 2)
- set maxLoc to getAt(slideRect, 4)
- set the locH of sprite spriteNo to getAt(slideRect, 1)
- else
- if getAt(slideRect, 2) = getAt(slideRect, 4) then
- set vertical to 0
- set minLoc to getAt(slideRect, 1)
- set maxLoc to getAt(slideRect, 3)
- set the locH of sprite spriteNo to getAt(slideRect, 2)
- else
- exit
- end if
- end if
- set itemNo to EMPTY
- set spriteNo to spriteNumber
- set currentNo to EMPTY
- set slideLocList1 to []
- set slideLocList2 to []
- return me
- end
-
- on slideListSet me, ItemNumber
- if ItemNumber = 1 then
- set itemNo to 1
- else
- set slideStep to float(maxLoc - minLoc) / (ItemNumber - 1)
- set slideHalfStep to integer(slideStep / 2)
- set slideLocList1 to []
- set slideLocList2 to []
- repeat with n = 1 to ItemNumber - 1
- add(slideLocList1, integer(minLoc + (slideStep * (n - 1))))
- add(slideLocList2, integer(minLoc + (slideStep * (n - 1))) + slideHalfStep)
- end repeat
- add(slideLocList1, maxLoc)
- sort(slideLocList2)
- set itemNo to ItemNumber
- end if
- end
-
- on slideMouseDown me, mouseDownOperation, mouseUpOperation
- if vertical then
- set theOffset to the locV of sprite spriteNo - getAt(clickLoc(), 2)
- repeat while the stillDown
- set mouseloc to mouseV() + theOffset
- if mouseloc < minLoc then
- set mouseloc to minLoc
- else
- if mouseloc > maxLoc then
- set mouseloc to maxLoc
- end if
- end if
- set the locV of sprite spriteNo to mouseloc
- updateStage()
- add(slideLocList2, mouseloc)
- set currentNo to getPos(slideLocList2, mouseloc)
- deleteAt(slideLocList2, currentNo)
- do(mouseDownOperation)
- end repeat
- if not voidp(currentNo) then
- set the locV of sprite spriteNo to getAt(slideLocList1, currentNo)
- updateStage()
- do(mouseUpOperation)
- end if
- else
- set theOffset to the locH of sprite spriteNo - getAt(clickLoc(), 1)
- repeat while the stillDown
- set mouseloc to mouseH() + theOffset
- if mouseloc < minLoc then
- set mouseloc to minLoc
- else
- if mouseloc > maxLoc then
- set mouseloc to maxLoc
- end if
- end if
- set the locH of sprite spriteNo to mouseloc
- updateStage()
- add(slideLocList2, mouseloc)
- set currentNo to getPos(slideLocList2, mouseloc)
- deleteAt(slideLocList2, currentNo)
- do(mouseDownOperation)
- end repeat
- if not voidp(currentNo) then
- set the locH of sprite spriteNo to getAt(slideLocList1, currentNo)
- updateStage()
- do(mouseUpOperation)
- end if
- end if
- end
-
- on slideLocSet me, newNo
- if (newNo >= 1) and (newNo <= itemNo) then
- if vertical then
- set the locV of sprite spriteNo to getAt(slideLocList1, newNo)
- else
- set the locH of sprite spriteNo to getAt(slideLocList1, newNo)
- end if
- updateStage()
- set currentNo to newNo
- end if
- end
-